package com.chinasi.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.caland.framework.core.page.Pager;
import com.chinasi.dao.ProductInfoDao;
import com.chinasi.model.ProductInfo;
import com.chinasi.service.ProductInfoService;

@Service
public class ProductInfoServiceImpl implements ProductInfoService {

	/**
	 * ProductInfoDAO
	 */
	@Autowired
	private ProductInfoDao productInfoDao;

	@Override
	public Pager findPageCondition(ProductInfo searchBean, int currentPage) {
		Pager pager = new Pager(productInfoDao.getTotalCount(searchBean),currentPage);
		pager.setData(productInfoDao.findByCondition(searchBean, pager.getStartRow(), pager.getPageSize()));
		return pager;
	}

	@Override
	public ProductInfo findById(String id) {
		return productInfoDao.findByPK(id, ProductInfo.class);
	}
	
}
